package com.flyduck.mall.oms.h5.controller;

import com.flyduck.ss.common.core.domain.R;

import com.flyduck.mall.oms.h5.service.H5RefundService;
import com.flyduck.mall.oms.h5.vo.H5RefundApplyReqVO;
import com.flyduck.mall.oms.h5.vo.H5RefundBaseDataRespVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * <p>
 * AppRefundController
 * </p>
 *
 * @author flyduck
 * @since 2024-05-23
 */
@RestController
@RequestMapping("/order/h5/refund")
public class H5RefundController {

    @Resource
    private H5RefundService h5RefundService;

    /**
     * 退款界面的基础数据
     */
    //@Login
    @GetMapping("/getRefundBaseDataByOrderId/{orderId}")
    public R<H5RefundBaseDataRespVO> getRefundBaseDataByOrderId(@PathVariable("orderId") Long orderId){
        H5RefundBaseDataRespVO h5RefundBaseDataRespVO = h5RefundService.getRefundBaseDataByOrderId(orderId);
        return R.ok(h5RefundBaseDataRespVO);
    }

    //@Login
    @PostMapping("/refundApply")
    public R<Void> refundApply(MultipartFile[] pics, @Validated H5RefundApplyReqVO h5RefundApplyReqVO){
        h5RefundService.refundApply(h5RefundApplyReqVO,pics);
        return R.ok();
    }
}
